package com.homework.zuoye2;

import java.util.ArrayList;

public class TestPerson {
    public static void main(String[] args) {
        Person p1 = new Person(1, "尼古拉斯", "男");
        Person p2 = new Person(2, "马尔扎哈", "男");
        Person p3 = new Person(3, "迪丽热巴", "女");
        Person p4 = new Person(4, "阿凡提买买提", "男");
        Person p5 = new Person(5, "王宝强", "男");
        Person p6 = new Person(6, "柳岩", "女");
        ArrayList<Person> people = new ArrayList<>();
        people.add(p1);
        people.add(p2);
        people.add(p3);
        people.add(p4);
        people.add(p5);
        people.add(p6);
        for (int i = 0; i < people.size(); i++) {
            Person p = people.get(i);
            if(p.getSex() == "男"&&p.getName().length()>=3){
                people.remove(i);
            }else {
                System.out.println("id:"+p.getId() + "\t性别:"+p.getSex() + "\t\t姓名:"+ p.getName());
            }
        }
    }
}
